package org.maxkey.portal.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * 用户实体类
 *  Mr.shi
 */
@Entity
@Table(
        name = "MXKP_USERINFO",
        indexes = {
                @Index(name = "LOGIN_NAME",  columnList="LOGIN_NAME", unique = true)})
@ToString
@Getter
@Setter
@SuppressWarnings("serial")
public class UserInfo implements java.io.Serializable{

    /**
     * 声明主键
     * 声明主键的自增策略
     */
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "ID")
    @GenericGenerator(name = "ID", strategy = "org.maxkey.portal.core.db.MIdentityGenerator")
    @Column(name="ID")
    //@ApiModelProperty(value="唯一标识")
    private Integer id;

    /**
     * 登录名
     */
    @Column(length = 64,name="LOGIN_NAME")
   // @ApiModelProperty(value="登录名")
    private String loginname;

    /**
     * 密码
     */
    @Column(length = 256,name="LOGIN_PWD")
    //@ApiModelProperty(value="密码")
    private String loginpwd;

    /**
     * 姓名
     */
    @Column(length = 20,name="NAME")
   // @ApiModelProperty(value="姓名")
    private String name;


    /**
     * 性别
     */
    @Column(length = 3,name="SEX")
   // @ApiModelProperty(value="性别")
    private Integer sex;

    /**
     * 状态
     */
    @Column(length = 3,name="STATUS")
   // @ApiModelProperty(value="状态")
    private Integer status;

    /**
     * 最后登录IP
     */
    @Column(name="LAST_LOGIN_IP",length = 20)
    //@ApiModelProperty(value="最后登录IP")
    private String lastLoginIp;

    /**
     * 最后登录时间
     */
    @Column(name="LAST_LOGIN_TIME")
    @JsonFormat(shape= JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date lastLoginTime;

    /**
     * 最后登录浏览器
     */
    @Column(name="LAST_LOGIN_AGENT",length = 128)
    //@ApiModelProperty(value="最后登录所用的浏览器")
    private String lastLoginAgent;

    @Column(name="IS_ADMIN")
    private Boolean isAdmin;


    /**
     * 创建时间
     */
    @Column(name="CREATE_TIME")
    @JsonFormat(shape= JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    /**
     * 修改时间
     */
    @Column(name="UPDATE_TIME")
    @JsonFormat(shape= JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date updateTime;


}
